package com.project.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.project.mapper.GoodsMapper;
import com.project.pojo.Goods;
import com.project.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodsServiceImpl implements GoodsService {
    @Autowired
    private GoodsMapper goodsMapper;

    @Override
    public List<Goods> queryAllGoods(Integer id) {
        //1.创建一个条件构造器
//        QueryWrapper<Goods> queryWrapper = new QueryWrapper<>();
        //2.设置条件  eq(boolean 是否执行条件, 列名, 值)
        //  eq(列名, 值) == eq(true, 列名, 值)
//        System.out.println(goodsMapper.selectList(id));
        return goodsMapper.selectListGoods(id);
    }

    @Override
    public List<Goods> selectAllGoods() {
        return goodsMapper.selectList();
    }
}
